
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author William
 */
public class testForeachList {
    public static void test(Object... objs){
        System.out.println("Type: " + objs.getClass());
    }

    public static void main(String args[]){
        String[] a = {"hello", "kiki", "i love you"};

        List<String> lista = Arrays.asList(a);

        for (String s : lista){
            System.out.println(s);
        }

        Map<String, Object> params = new HashMap<String, Object>();
        params.put("LoveMessage", lista);
        params.put("By", "William");
        for (Map.Entry<String, Object> e : params.entrySet()){
            System.out.print("Key: " + e.getKey() + ", ");

            if (e.getValue() instanceof List){
                System.out.print("Val is a List: ");
                List<String> vl = (List) e.getValue();
                for (String v : vl){
                    System.out.print(v + ", ");
                }
            }else{
                System.out.print("Val: " + e.getValue().toString());
            }
            System.out.println(" ");
        }

        test("Hello", 12348);
    }
}
